import { post, get } from "../../../utils/request";
import { getCurrentTenant } from '../../../utils/utils';

export const getMessageTemplateList = data => post('mgt/messageTemplate/list', { ...data, tenantCodeList: (getCurrentTenant() || { tenantCode: '' }).tenantCode });
export const saveMessageTemplate = data => post('mgt/messageTemplate/save', data);
export const getSmsSign = () => get('mgt/smsSign');
export const getAllSmsSign = () => post('mgt/smsSign/findAll');

export const getTemplateOwnerDept = data => post('mgt/messageTemplate/ownerDept', data);
// export const commitMessageTemplate = data => post('mgt/messageTemplate/commit', data);
export const commitMessageTemplate = data => post('mgt/messageTemplate/saveTemplate', { ...data, tenantCode: (getCurrentTenant() || { tenantCode: '' }).tenantCode[0] });
export const updateMessageTemplate = data => post('mgt/messageTemplate/updateTemplate', { ...data, tenantCode: (getCurrentTenant() || { tenantCode: '' }).tenantCode[0] });
export const updateTemplateStatus = data => post('mgt/messageTemplate/updateStatus', data);
export const offLineTemplate = data => post('mgt/messageTemplate/offLine', data);
// export const deleteMessageTemplate = data => del('mgt/messageTemplate/delete', data);
export const deleteMessageTemplate = data => post('mgt/messageTemplate/isDelete', data);
export const getTemplateDetail = data => post('mgt/messageTemplate/detail', data);
export const getTemplateToDeal = data => post('mgt/messageTemplate/toDeal', data);

export const approveTemplate = data => post('mgt/pendingEvent/handleTemplate', data);

export const queryUnBindMsgSourceTemplate = channelType => post(`mgt/messageTemplate/queryUnBindMsgSourceTemplate?channelType=${channelType}`);
